<?php
	require_once("person.php");
	class employee extends person
	{
		private $empid, $did, $doj, $bankac, $basic, $hra, $dall, $cityall, $otherall, $oalldsc, $pfund, $pfno, $othercuts, $ocutsdsc;


// Does a particular EmpId exist?

		function doesEmpIdExist($id)
		{
			$sql="select * from emp where empid=$id";
			$result=$this->db->query($sql);
			if (DB::isError($result)) {
				die ($result->getMessage());
			}
			$row=$result->fetchRow();
			if($result->numRows()!=0)
			{
				return 1;
			}
			else
			{
				return 0;
			}
		}



// Read record of an employee by Employee ID

		public function readByEmpId($id)
		{
			$this->db->setFetchMode(DB_FETCHMODE_ASSOC);
			$sql='select emp.uid uid,empid, pname name, did, fname,mname,dob,doj,sex,edu,hno,street,city,pcode,email,phone,bankac,basic,hra,dall,cityall,otherall,oalldsc,pfund,pfno,othercuts,ocutsdsc from person,emp where person.uid=emp.uid and emp.empid='.$id;
			$result=$this->db->query($sql);
			if (DB::isError($result)) {
				die ($result->getMessage());
			}
			$row=$result->fetchRow();
			if($result->numRows()!=0)
			{
				$this->uid=$row['uid'];
				$this->empid=$row['empid'];
				$this->name=$row['name'];
				$this->did=$row['did'];
				$this->fname=$row['fnme'];
				$this->mname=$row['mname'];
				$this->dob=$row['dob'];
				$this->doj=$row['doj'];
				$this->sex=$row['sex'];
				$this->edu=$row['edu'];
				$this->hno=$row['hno'];
				$this->street=$row['street'];
				$this->city=$row['city'];
				$this->pcode=$row['pcode'];
				$this->email=$row['email'];
				$this->phone=$row['phone'];
				$this->bankac=$row['bankac'];
				$this->basic=$row['basic'];
				$this->hra=$row['hra'];
				$this->dall=$row['dall'];
				$this->cityall=$row['cityall'];
				$this->otherall=$row['otherall'];
				$this->oalldsc=$row['oalldsc'];
				$this->pfund=$row['pfund'];
				$this->pfno=$row['pfno'];
				$this->othercuts=$row['othercuts'];
				$this->ocutsdsc=$row['ocutsdsc'];
				$this->available=1;
			}
			else
				$this->available=0;
			$result->free();
		}



// Read record of an employee by User ID

		public function readByUID($id)
		{
			$this->db->setFetchMode(DB_FETCHMODE_ASSOC);
			$sql='select emp.uid uid,empid, pname name, did, fname,mname,dob,doj,sex,edu,hno,street,city,pcode,email,phone,bankac,basic,hra,dall,cityall,otherall,oalldsc,pfund,pfno,othercuts,ocutsdsc from person,emp where person.uid=emp.uid and emp.uid='.$this->db->quoteSmart($id);
			$result=$this->db->query($sql);
			if (DB::isError($result)) {
				die ($result->getMessage());
			}
			$row=$result->fetchRow();
			if($result->numRows()!=0)
			{
				$this->uid=$row['uid'];
				$this->empid=$row['empid'];
				$this->name=$row['name'];
				$this->did=$row['did'];
				$this->fname=$row['fnme'];
				$this->mname=$row['mname'];
				$this->dob=$row['dob'];
				$this->doj=$row['doj'];
				$this->sex=$row['sex'];
				$this->edu=$row['edu'];
				$this->hno=$row['hno'];
				$this->street=$row['street'];
				$this->city=$row['city'];
				$this->pcode=$row['pcode'];
				$this->email=$row['email'];
				$this->phone=$row['phone'];
				$this->bankac=$row['bankac'];
				$this->basic=$row['basic'];
				$this->hra=$row['hra'];
				$this->dall=$row['dall'];
				$this->cityall=$row['cityall'];
				$this->otherall=$row['otherall'];
				$this->oalldsc=$row['oalldsc'];
				$this->pfund=$row['pfund'];
				$this->pfno=$row['pfno'];
				$this->othercuts=$row['othercuts'];
				$this->ocutsdsc=$row['ocutsdsc'];
				$this->available=1;
			}
			else
				$this->available=0;
			$result->free();
		}

// Constructor


		function __construct($id=0)
		{
			person::__construct();
			$this->readByUID($id);
		}

// Get Sst empid

		public function setEmpId($value)
		{
			$this->empid=$value;
		}
		public function getEmpId()
		{
			return $this->empid;
		}

// Get Set DeptId

		public function setDeptId($value)
		{
			$this->did=$value;
		}
		public function getDeptId()
		{
			return $this->did;
		}

// Get Set Date Of Joining

		public function setDOJ($value)
		{
			$this->doj=$value;
		}
		public function getDOJ()
		{
			return $this->doj;
		}

// Get Set Education

		public function setEdu($value)
		{
			$this->edu=$value;
		}
		public function getEdu()
		{
			return $this->edu;
		}


// Get Set E-mail

		public function setEmail($value)
		{
			$this->email=$value;
		}
		public function getEmail()
		{
			return $this->email;
		}


// Get Set Pnone Number

		public function setPhone($value)
		{
			$this->phone=$value;
		}
		public function getPhone()
		{
			return $this->phone;
		}

	
// Get Set Bank Account Number 

		public function setBankAc($value)
		{
			$this->bankac=$value;
		}
		public function getBankAc()
		{
			return $this->bankac;
		}

// Get Set Basic Pay

		public function setBasic($value)
		{
			$this->basic=$value;
		}
		public function getBasic()
		{
			return $this->basic;
		}


// Get Set House Rent Allowance

		public function setHRA($value)
		{
			$this->hra=$value;
		}
		public function getHRA()
		{
			return $this->hra;
		}


// Get Set Dearness Allowance

		public function setDA($value)
		{
			$this->dall=$value;
		}
		public function getDA()
		{
			return $this->dall;
		}


// Get Set City Compensatory Allowance

		public function setCCA($value)
		{
			$this->cityall=$value;
		}
		public function getCCA()
		{
			return $this->cityall;
		}
		

// Get Set Other Allowances

		public function setOA($value)
		{
			$this->otherall=$value;
		}
		public function getOA()
		{
			return $this->otherall;
		}


// Get Set Description of Other Allowances

		public function setOADsc($value)
		{
			$this->oalldsc=$value;
		}
		public function getOADsc()
		{
			return $this->oalldsc;
		}


// Get Set Provident Fund Cutting

		public function setPF($value)
		{
			$this->pfund=$value;
		}
		public function getPF()
		{
			return $this->pfund;
		}


// Get Set Provident Fund Number

		public function setPFNo($value)
		{
			$this->pfno=$value;
		}
		public function getPGNo()
		{
			return $this->pfno;
		}


// Get Set Other Custs from Salary

		public function setOtherCuts($value)
		{
			$this->othercuts=$value;
		}
		public function getOtherCuts()
		{
			return $this->othercuts;
		}

// Get Set Description of Other Cuts

		public function setOtherCutsDsc($value)
		{
			$this->ocutsdsc=$value;
		}
		public function getOtherCutsDsc()
		{
			return $this->ocutsdsc;
		}



// End of class employee
	}
?>

